﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Json_Jsonreader : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string jsonText = "[{'a':'1'},{fsdfsdf:'value'},{property:'value'}]";
        Newtonsoft.Json.JsonReader reader = new Newtonsoft.Json.JsonReader(new System.IO.StringReader(jsonText));

        string list = "";
       Newtonsoft.Json.JsonToken ptoken= Newtonsoft.Json.JsonToken.None;

       List<string> strs = new List<string>();
        while (reader.Read())
        {

            if (reader.TokenType == Newtonsoft.Json.JsonToken.StartObject)
            {
                list = "{";
                continue;
            }
            if (reader.TokenType == Newtonsoft.Json.JsonToken.PropertyName)
            {
                list += "\"" + reader.Value + "\":";
                ptoken = Newtonsoft.Json.JsonToken.PropertyName;
                continue;
            }
            if (ptoken == Newtonsoft.Json.JsonToken.PropertyName)
            {
                list += "\"" + reader.Value + "\"";
                ptoken = Newtonsoft.Json.JsonToken.None;
                continue;
            }
            if (reader.TokenType == Newtonsoft.Json.JsonToken.EndObject)
            {
                list += "}";
                strs.Add(list);
                list = string.Empty;
                continue;
            }

           
//StartArray				
//StartObject				
//PropertyName		System.String		a
//String		System.String		1
//EndObject								
//EndArray

 
            Response.Write(reader.TokenType + "\t\t" + reader.ValueType + "\t\t" + reader.Value+"\r\n");
        }

        Response.Write(string.Join(",", strs));
    }
}